﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace _5LabaNumber2
{
    public partial class Form1 : Form
    {
        Data data;
        Arsenal unit;
        Logger ilog;

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            data = new Data();
            unit = new Arsenal();
            data.BindCreators();
            data.BindDate();
            label5.Text = "Цена комплекта: None;";
            label6.Text = "Вес комплекта: None;";
                unit.Fire1 = data.fire[4];
                unit.Fire2 = data.fire[4];
                unit.Fire3 = data.fire[4];
                unit.Fire4 = data.fire[4];
                unit.Cold1 = data.cold[4];
                unit.Cold2 = data.cold[4];
                unit.Cold3 = data.cold[4];
                unit.Cold4 = data.cold[4];
            
        }

        private void button1_Click(object sender, EventArgs e)
        {
           
                unit.Name = textBox1.Text;
                label5.Text = "Цена ожерелья: " + Convert.ToString(unit.Cost()) + ";";
                label6.Text = "Вес ожерелья: " + Convert.ToString(unit.Weight()) + ";";
                ilog = new Logger();
                ilog.File(unit);
            
        }

        


        private void checkBox3_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox3.Checked == true)
            {
                unit.Fire1 = data.fire[0];
                info1.Text = "Название: " + unit.Fire1.Name + Environment.NewLine
                    + "Цена: " + unit.Fire1.Price + Environment.NewLine
                    + "Вес: " + unit.Fire1.Weight + Environment.NewLine
                    + "Назначение: " + unit.Fire1.Appointment + Environment.NewLine
                    + "Калибр: " + unit.Fire1.Capacity + Environment.NewLine
                    + "Дальность: 1200 ";
            }
            else unit.Fire1 = data.fire[4];
        }

        private void checkBox4_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox4.Checked == true)
            {
                unit.Fire2 = data.fire[1];
                info1.Text = "Название: " + unit.Fire2.Name + Environment.NewLine
                    + "Цена: " + unit.Fire2.Price + Environment.NewLine
                    + "Вес: " + unit.Fire2.Weight + Environment.NewLine
                    + "Назначение: " + unit.Fire2.Appointment + Environment.NewLine
                    + "Калибр: " + unit.Fire2.Capacity + Environment.NewLine
                    + "Дальность: 1200 ";
            }
            else unit.Fire2 = data.fire[4];

        }

        private void checkBox5_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox5.Checked == true)
            {
                unit.Fire3 = data.fire[2];
                info1.Text = "Название: " + unit.Fire3.Name + Environment.NewLine
                    + "Цена: " + unit.Fire3.Price + Environment.NewLine
                    + "Вес: " + unit.Fire3.Weight + Environment.NewLine
                    + "Назначение: " + unit.Fire3.Appointment + Environment.NewLine
                    + "Калибр: " + unit.Fire3.Capacity + Environment.NewLine
                    + "Снаряд: A16";
            }
            else unit.Fire3 = data.fire[4];
        }

        private void checkBox6_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox6.Checked == true)
            {
                unit.Fire4 = data.fire[3];
                info1.Text = "Название: " + unit.Fire4.Name + Environment.NewLine
                    + "Цена: " + unit.Fire4.Price + Environment.NewLine
                    + "Вес: " + unit.Fire4.Weight + Environment.NewLine
                    + "Назначение: " + unit.Fire4.Appointment + Environment.NewLine
                    + "Калибр: " + unit.Fire4.Capacity + Environment.NewLine
                    + "Снаряд: М32";
            }
            else unit.Fire4 = data.fire[4];
        }

        private void checkBox8_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox8.Checked == true)
            {
                unit.Cold1 = data.cold[0];
                info2.Text = "Название: " + unit.Cold1.Name + Environment.NewLine
                    + "Цена: " + unit.Cold1.Price + Environment.NewLine
                    + "Вес: " + unit.Cold1.Weight + Environment.NewLine
                    + "Длина: " + unit.Cold1.length + Environment.NewLine
                    + "Руки: " + unit.Cold1.handCount + Environment.NewLine
                    + "Материал: " + unit.Cold1.material + Environment.NewLine;
            }
            else unit.Cold1 = data.cold[4];
        }

        private void checkBox7_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox7.Checked == true)
            {
                unit.Cold2 = data.cold[1];
                info2.Text = "Название: " + unit.Cold2.Name + Environment.NewLine
                    + "Цена: " + unit.Cold2.Price + Environment.NewLine
                    + "Вес: " + unit.Cold2.Weight + Environment.NewLine
                    + "Длина: " + unit.Cold2.length + Environment.NewLine
                    + "Руки: " + unit.Cold2.handCount + Environment.NewLine
                    + "Материал: " + unit.Cold2.material + Environment.NewLine;
            }
            else unit.Cold2 = data.cold[4];
        }

        private void checkBox2_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox2.Checked == true)
            {
                unit.Cold3 = data.cold[2];
                info2.Text = "Название: " + unit.Cold3.Name + Environment.NewLine
                    + "Цена: " + unit.Cold3.Price + Environment.NewLine
                    + "Вес: " + unit.Cold3.Weight + Environment.NewLine
                    + "Длина: " + unit.Cold3.length + Environment.NewLine
                    + "Руки: " + unit.Cold3.handCount + Environment.NewLine
                    + "Материал: " + unit.Cold3.material + Environment.NewLine
                + "Количество: 15";
            }
            else unit.Cold3 = data.cold[4];
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox1.Checked == true)
            {
                unit.Cold4 = data.cold[3];
                info2.Text = "Название: " + unit.Cold4.Name + Environment.NewLine
                    + "Цена: " + unit.Cold4.Price + Environment.NewLine
                    + "Вес: " + unit.Cold4.Weight + Environment.NewLine
                    + "Длина: " + unit.Cold4.length + Environment.NewLine
                    + "Руки: " + unit.Cold4.handCount + Environment.NewLine
                    + "Материал: " + unit.Cold4.material + Environment.NewLine
                    + "Количество: 15" ;
            }
            else unit.Cold4 = data.cold[4];
        }

        private void button2_Click(object sender, EventArgs e)
        {
            //(button2 as Control).Dispose(); 
               
               
               if (checkBox5.Checked == false)
                   groupBox2.Controls.Remove(checkBox5 as Control);
               if (checkBox3.Checked == false)
                   groupBox2.Controls.Remove(checkBox3 as Control);
               if (checkBox4.Checked == false)
                   groupBox2.Controls.Remove(checkBox4 as Control);
               if (checkBox6.Checked == false)
                   groupBox2.Controls.Remove(checkBox6 as Control);

               if (checkBox1.Checked == false)
                   groupBox1.Controls.Remove(checkBox1 as Control);
               if (checkBox2.Checked == false)
                   groupBox1.Controls.Remove(checkBox2 as Control);
               if (checkBox7.Checked == false)
                   groupBox1.Controls.Remove(checkBox7 as Control);
               if (checkBox8.Checked == false)
                   groupBox1.Controls.Remove(checkBox8 as Control);  
            
        }

  

 



    }
}
